// pages/goodsSuccess/goodsSuccess.js

const app = getApp();
import http from '../../utils/http.js';
import util from '../../utils/util'

Page({
  /**
   * 页面的初始数据
   */
  data: {
    id:'',
    mobile:'',
    time:'',
    info:{}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let time = util.getDefaultDate()
    this.setData({
      id:options.id,
      mobile:wx.getStorageSync('shopInfo').phone,
      time:time
    })
    this.getGoodsInfo();
  },
  getGoodsInfo(){
    let that = this
    http.post('/api/order/v1/goods/scan/code', {
      id: that.data.id
    }).then(res => {
      console.log(res.data)
      if (res.code === 200) {
        that.setData({
          info: res.data
        })
      } else {
        wx.showToast({
          title: res.message,
          icon:'none'
        })
      }
    })
  },
  WeixinServer(){
    wx.openCustomerServiceChat({
      extInfo: {
        url: 'https://work.weixin.qq.com/kfid/kfc11f5184d7762c658'
      },
      corpId: 'ww106853c8ad050781',
      success(res) {
        console.log(res)
      },
      fail(fail){
        console.log(fail)
      }
    })
  }
})